home *** CD-ROM | disk | FTP | other *** search
- package
- {
- import Common.SoundManager;
- import Forms.DressupForm;
- import flash.utils.setTimeout;
- import org.flintparticles.actions.Accelerate;
- import org.flintparticles.actions.Age;
- import org.flintparticles.actions.Fade;
- import org.flintparticles.actions.Move;
- import org.flintparticles.counters.Blast;
- import org.flintparticles.emitters.Emitter;
- import org.flintparticles.initializers.ImageClasses;
- import org.flintparticles.initializers.Lifetime;
- import org.flintparticles.initializers.Position;
- import org.flintparticles.initializers.Velocity;
- import org.flintparticles.renderers.DisplayObjectRenderer;
- import org.flintparticles.zones.MultiZone;
- import org.flintparticles.zones.RectangleZone;
-
- public class PowerupReshuffle extends Powerup
- {
-
-
- protected const NUM_PARTICLES:int = 100;
-
- internal var _dressupform:DressupForm;
-
- internal var _renderer:DisplayObjectRenderer;
-
- protected const PARTICLE_SPEED:int = 25;
-
- internal var _emitter:Emitter;
-
- protected const ZONE_WIDTH:int = 50;
-
- public function PowerupReshuffle()
- {
- super();
- _sName = "reshuffle";
- _sDescription = "Replaces current selection of clothing";
- }
-
- override public function spawn() : Powerup
- {
- return new PowerupReshuffle();
- }
-
- protected function eraseEffect() : void
- {
- _emitter.pause();
- _dressupform.removeChild(_renderer);
- _emitter = null;
- _renderer = null;
- }
-
- override public function activate(param1:Array, param2:Array, param3:DressupForm, param4:DressupLevelInfo) : void
- {
- var _loc5_:MultiZone = null;
- var _loc6_:ClothingSlot = null;
- super.activate(param1,param2,param3,param4);
- param3.fillSlots(true);
- SoundManager.getInstance().playSound("PowerupRandomizeSound");
- _emitter = new Emitter();
- _emitter.counter = new Blast(NUM_PARTICLES);
- _emitter.addInitializer(new ImageClasses([KintabLarge,KintabSmall]));
- _emitter.addInitializer(new Lifetime(0.1,3));
- _emitter.addAction(new Age());
- _emitter.addAction(new Fade());
- _loc5_ = new MultiZone();
- for each(_loc6_ in param1)
- {
- if(_loc6_.hasPart())
- {
- _loc5_.addZone(new RectangleZone(_loc6_.x - ZONE_WIDTH / 2,_loc6_.y - ZONE_WIDTH / 2,_loc6_.x + ZONE_WIDTH / 2,_loc6_.y + ZONE_WIDTH / 2));
- }
- }
- _emitter.addInitializer(new Position(_loc5_));
- _emitter.addInitializer(new Velocity(new RectangleZone(-PARTICLE_SPEED,-PARTICLE_SPEED,0,0)));
- _emitter.addAction(new Accelerate(0,-30));
- _emitter.addAction(new Move());
- _renderer = new DisplayObjectRenderer();
- _emitter.renderer = _renderer;
- _dressupform = param3;
- param3.addChild(_renderer);
- _emitter.start();
- setTimeout(eraseEffect,3000);
- }
- }
- }
-